/**
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GD32F4X0I_EVAL_TSC2007_TS_H
#define __GD32F4X0I_EVAL_TSC2007_TS_H

#ifdef __cplusplus
 extern "C" {
#endif   
   
/* Includes ------------------------------------------------------------------*/
#include "stdint.h"

#define TS_MAX_NB_TOUCH		1   
/** @addtogroup BSP
  * @{
  */ 

/** @addtogroup GD32F4xxI_EVAL
  * @{
  */
    
/** @defgroup GD32F4xxI_EVAL_TS
  * @{
  */    

/** @defgroup GD32F4xxI_EVAL_TS_Exported_Types
  * @{
  */

typedef struct __touchPoint
{
		uint32_t x;
		uint32_t y;
}touchPoint_t;

typedef struct __touchParam
{
		uint32_t HaveAdjust;
		float kx;
		float dx;
		float ky;
		float dy;
}touchParam_t;

typedef struct __lcdSize
{
		uint16_t width;
		uint16_t height;
}lcdSize_t;

typedef struct
{
  uint8_t  touchDetected;                /*!< Total number of active touches detected at last scan */
  uint16_t touchX[TS_MAX_NB_TOUCH];      /*!< Touch X[0], X[1] coordinates on 12 bits */
  uint16_t touchY[TS_MAX_NB_TOUCH];      /*!< Touch Y[0], Y[1] coordinates on 12 bits */
//	uint16_t touchZ[TS_MAX_NB_TOUCH];      /*!< Touch Y[0], Y[1] coordinates on 12 bits */
} TS_StateTypeDef;
/**
  * @}
  */ 

/** @defgroup GD32F4xxI_EVAL_TS_Exported_Constants
  * @{
  */
#define TP_INT_PERIPH	            RCU_GPIOH
#define TP_INT_PORT		            GPIOH
#define TP_INT_PIN		            GPIO_PIN_5


#define TS_SWAP_NONE                    ((uint8_t)0x00)
#define TS_SWAP_X                       ((uint8_t)0x01)
#define TS_SWAP_Y                       ((uint8_t)0x02)
#define TS_SWAP_XY                      ((uint8_t)0x04)

typedef enum 
{
  TS_OK                = 0x00, /*!< Touch Ok */
  TS_ERROR             = 0x01, /*!< Touch Error */
  TS_TIMEOUT           = 0x02, /*!< Touch Timeout */
  TS_DEVICE_NOT_FOUND  = 0x03  /*!< Touchscreen device not found */
}TS_StatusTypeDef;

/**
  * @}
  */ 

/** @defgroup GD32F4xxI_EVAL_TS_Exported_Macros
  * @{
  */ 
/**
  * @}
  */ 

/** @defgroup GD32F4xxI_EVAL_TS_Exported_Functions
  * @{
  */
uint8_t BSP_TS_Init(void);
uint8_t BSP_TS_DeInit(void);
uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
uint8_t BSP_TS_ITConfig(void);
uint8_t BSP_TS_ITGetStatus(void);
void    BSP_TS_ITClear(void);

/**
  * @}
  */ 

/**
  * @}
  */

/**
  * @}
  */ 

/**
  * @}
  */


#ifdef __cplusplus
}
#endif

#endif /* __GD32F4X0I_EVAL_TSC2007_TS_H */

/*****************************END OF FILE****/
